package com.atguigu.campusintelligentassistantsystem.entity;

public enum ScholarshipLevel {
    NATIONAL("national", "国家级"),
    PROVINCIAL("provincial", "省级"),
    SCHOOL("school", "校级");

    private final String code;
    private final String description;

    ScholarshipLevel(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    @Override
    public String toString() {
        return code;
    }

    public static ScholarshipLevel fromCode(String code) {
        for (ScholarshipLevel level : ScholarshipLevel.values()) {
            if (level.getCode().equals(code)) {
                return level;
            }
        }
        throw new IllegalArgumentException("未知的奖学金级别: " + code);
    }
}